package com.gaoyi.crm.fragment.ctm;

import android.widget.RadioGroup;

import androidx.activity.result.ActivityResult;

import com.gaoyi.crm.R;
import com.gaoyi.crm.databinding.FragmentCtmSyncedBinding;
import com.gaoyi.crm.db.dto.SyncedCustomerDto;
import com.gaoyi.crm.db.query.CtmSyncedQuery;
import com.gaoyi.crm.fragment.base.BaseParentFragment;
import com.gaoyi.crm.vm.CtmSyncedCusViewModel;

import java.util.Map;

public class CtmSyncedFragment extends BaseParentFragment<FragmentCtmSyncedBinding, CtmSyncedCusViewModel, SyncedCustomerDto> {

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_ctm_synced;
    }

    @Override
    protected int getFragmentId() {
        return R.id.ctm_fragment;
    }

    @Override
    protected void initView() {
        mBinding.rgCtmType.setOnCheckedChangeListener(new MyOnCheckChangeListener());
        mBinding.rgCtmType.check(R.id.rb_customer);
    }

    private class MyOnCheckChangeListener implements RadioGroup.OnCheckedChangeListener {

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
            if (i == R.id.rb_item_no) {
                showFragment(0);
            } else {
                showFragment(1);
            }
        }
    }

    @Override
    protected void initFragment() {
        setFragment(new CtmSyncedItemNoFragment());
        setFragment(new CtmSyncedCusFragment());
    }

    @Override
    protected void initLiveData() {
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void onRequestPermissionsResult(Map<String, Boolean> result) {

    }

    @Override
    protected void onActivityResult(int requestCode, ActivityResult result) {

    }
}